package com.zyl.customkeyboard;

import android.app.Dialog;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;

import com.zyl.customkeyboardview.CustomKeyboardEditText;

/**
 * Description: 封装后的自定义KeyboardEditText
 * Created by zouyulong on 2017/7/26.
 * Email : zouyulong@syswin.com
 * Person in charge :  zouyulong
 */
public class KeyboardEditTextActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_keyboard_edittext);

        findViewById(R.id.tv_submit).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Dialog dialog = new Dialog(KeyboardEditTextActivity.this);

                dialog.setContentView(R.layout.dialog_test);

                CustomKeyboardEditText viewById = (CustomKeyboardEditText) dialog.findViewById(R.id.et_identity_card);
                Window window = dialog.getWindow();
                WindowManager.LayoutParams layoutParams = window.getAttributes();
                layoutParams.gravity = Gravity.CENTER;
                layoutParams.width = ViewGroup.LayoutParams.MATCH_PARENT;
                layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT;

//                window.getDecorView().setPadding(0, 0, 0, 0);

//                window.setAttributes(layoutParams);
                window.setBackgroundDrawable(new ColorDrawable());
                dialog.show();

//                window.setBackgroundDrawable(new ColorDrawable(0));
//
//                viewById.setWindow(dialog.getWindow());
            }
        });
    }
}
